﻿using System.Collections.Generic;

namespace SegmentDisplay.Common.Digit09
{
    public static class ValueSet09
    {
        public static Dictionary<string, Values09> Alphabet = new Dictionary<string, Values09>();
              
        static ValueSet09()
        {
            Alphabet.Add("Empty", Values09.SimbolEmpty);
            Alphabet.Add("0", Values09.Digit0);
            Alphabet.Add("1", Values09.Digit1);
            Alphabet.Add("2", Values09.Digit2);
            Alphabet.Add("3", Values09.Digit3);
            Alphabet.Add("4", Values09.Digit4);
            Alphabet.Add("5", Values09.Digit5);
            Alphabet.Add("6", Values09.Digit6);
            Alphabet.Add("7", Values09.Digit7);
            Alphabet.Add("8", Values09.Digit8);
            Alphabet.Add("9", Values09.Digit9);
            Alphabet.Add("n", Values09.Digitn);
            Alphabet.Add("L", Values09.DigitL);
            return;
        }

        public static Values09 GetVector(string simbol)
        {
            Values09 result = Values09.SimbolEmpty;
            if(!string.IsNullOrEmpty(simbol))
            {
                string invariant = simbol.Trim().ToUpper();
                if (invariant.Length == 1)
                    Alphabet.TryGetValue(invariant, out result);
            }
            return result;
        }
    }
}
